MATRIX

Section: Lightweight Processes Library (3L)
Updated: 12-Oct-1982
Index Return to Main Contents
 

NAME

m_cofactor, m_copy, m_determ, m_invert, m_multiply, m_solve, m_transpose - matrix manipulation subroutines  

SYNOPSIS

#include <local/mat.h>
cc *.c -lmatrix

double m_cofactor(m, i, j);
struct matrix *m;
int i, j;

struct matrix *m_copy(m);
struct matrix *m;

double m_determ(m);
struct matrix *m;

struct matrix *m_invert(m);
struct matrix *m;

struct matrix *m_multiply(m1, m2);
struct matrix *m1;
struct matrix *m2;

struct matrix *m_solve(a, b);
struct matrix *a;
struct matrix *b;

struct matrix *m_transpose(m);
struct matrix *m;  

DESCRIPTION

This set of subroutines does several useful operations on matrices which are stored in a standard format (defined in /usr/include/local/matrix.h). Space for matrices is allocated and freed by the subroutines malloc and free. Matrices should be initialized by the macro m_create, and can be disposed of by passing a pointer to the matrix to free.

m_cofactor(m, i, j) returns the cofactor, as type double, of element (i, j) of the matrix given by its first argument. That is: the determinant of the matrix obtained by deleting row i and column j from the matrix m, multiplied by
(-1)**(i+j).

m_copy(m) returns a duplicate copy of the matrix m.

m_determ(m) returns the determinant of the matrix m as type double.

m_invert(m) returns a matrix (if it exists) which is the inverse of the matrix m.

m_multiply(m1, m2) returns a matrix which is the result of multiplying matrix m1 by matrix m2 by the conventional definition of matrix multiplication. The number of columns in m1 must be the same as the number of rows in m2.

m_solve(a, b) returns the matrix which results from computing: (a' a)**(-1) a' b. This is useful for solving a set of linear equations expressed as matrices: a x = b.

m_transpose(m) returns the matrix which is the transpose of m.

m_create(m, r, c) (which is a macro, not a function) allocates space for, and initializes the matrix m to have r rows and c columns.

m_v(m, r, c) is a macro used to access element (r, c) of the matrix m. The elements are always of type double.  

AUTHOR

Fred Blonder <fred@umcp-cs>  

SEE ALSO

malloc(3), free(3), printf(3)  

DIAGNOSTICS

Most routines return the constant M_NULL to report an error. Some also write messages to the standard output via printf.  

FILES

/usr/include/local/matrix.h
/usr/lib/libmatrix.a  

BUGS

Error reporting via printf should be an option.
 

Index

NAME
SYNOPSIS
DESCRIPTION
AUTHOR
SEE ALSO
DIAGNOSTICS
FILES
BUGS

This document was created by man2html, using the manual pages.
Time: 04:29:53 GMT, January 14, 2023